//
//  YHYHunterCityDataViewController.m
//  TripTogether
//
//  Created by 杨泓晔 on 15/12/24.
//  Copyright © 2015年 杨泓晔. All rights reserved.
//

#import "YHYHunterCityDataViewController.h"

@interface YHYHunterCityDataViewController ()<UIWebViewDelegate>
@property (retain, nonatomic) UIProgressView *progress;
@property (nonatomic, strong)MBProgressHUD *HUB;
@property (retain, nonatomic) UIActivityIndicatorView *hunter;


@end

@implementation YHYHunterCityDataViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
#pragma mark - 城市猎人 详情页面
    
    
    self.navigationItem.title = @"体验详情";
    //修改导航栏标题颜色
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor]};
    NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://web.breadtrip.com/hunter/product/%@/",self.product_id]];
    
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    UIWebView *webView = [[UIWebView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
    [self.view addSubview:webView];
    
    [webView loadRequest:request];
    
    webView.delegate = self;
    
    self.hunter.hidesWhenStopped = YES;
    
   

}

-(void)webViewDidStartLoad:(UIWebView *)webView{
    
    self.HUB = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    [self.HUB show:YES];
    self.HUB.labelText = @"正在加载..";



}

-(void)webViewDidFinishLoad:(UIWebView *)webView{
    [self.progress setProgress:1 animated:YES];
    [self.HUB hide:YES];
}
//#pragma mark === 页面开始加载的时候
//-(void)webViewDidStartLoad:(UIWebView *)webView{
//    
//#pragma mark 加载动画
//    [MBProgressHUD setGifWithMBProgress:@"加载中" toView:self.view];
//    
//    [self.progress setProgress:0 animated:false];
//    [self.hunter startAnimating];
//}
//#pragma mark === 页面加载结束
//-(void)webViewDidFinishLoad:(UIWebView *)webView{
//    [self.progress setProgress:1 animated:YES];
//    
//#pragma mark 加载动画消失
//    [MBProgressHUD hideHUDForView:self.view];
//    
//    [self.hunter stopAnimating];
//}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
